/*
 * $Id: ErrorController.java 46 2013-05-03 21:38:12Z gabakyan $
 * $Author: gabakyan $
 * $Revision: 46 $
 * $Date: 2013-05-03 21:38:12 +0000 (Fri, 03 May 2013) $
 *
 * Copyright (c) 2013 Supply Chain Intelligence (SCI), Inc.
 * http://www.scintelligence.com/, Email: info@scintelligence.com
 * All rights reserved.
 *
 * This file is part of Logistics Map.
 *
 * Logistics Map is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * Logistics Map is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Logistics Map.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.sci.logisticsmap.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.PostConstruct;

/**
 * The Controller for processing error view/ajax requests.
 *
 * @author gabakyan@gmail.com (Last modified by $Author: gabakyan $)
 * @version $Revision: 46 $
 */
@Controller
@RequestMapping("")
public class ErrorController extends BaseController {
    /**
     * The 400 error path.
     */
    public static final String PATH_ERROR_400 = "/error/400";
    /**
     * The 401 error path.
     */
    public static final String PATH_ERROR_401 = "/error/401";
    /**
     * The 403 error path.
     */
    public static final String PATH_ERROR_403 = "/error/403";
    /**
     * The 404 error path.
     */
    public static final String PATH_ERROR_404 = "/error/404";
    /**
     * The 405 error path.
     */
    public static final String PATH_ERROR_405 = "/error/405";
    /**
     * The 500 error path.
     */
    public static final String PATH_ERROR_500 = "/error/500";

    /**
     * The 400 error view.
     */
    private static final String view400 = "error/400Page";
    /**
     * The 401 error view.
     */
    private static final String view401 = "error/401Page";
    /**
     * The 403 error view.
     */
    private static final String view403 = "error/403Page";
    /**
     * The 404 error view.
     */
    private static final String view404 = "error/404Page";
    /**
     * The 405 error view.
     */
    private static final String view405 = "error/405Page";
    /**
     * The 500 error view.
     */
    private static final String view500 = "error/500Page";

    /**
     * The default constructor.
     * Initializes a Controller class.
     */
    public ErrorController() {
    }

    /*
     * (non-Javadoc)
     *
     * @see BaseController#init()
     */
    @PostConstruct
    public void init() {
        super.init();
    }

    /**
     * The method to response on the 400 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 400 error view.
     */
    @RequestMapping(value=PATH_ERROR_400)
    public String on400(Model model) {
        return view400;
    }

    /**
     * The method to response on the 401 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 401 error view.
     */
    @RequestMapping(value=PATH_ERROR_401)
    public String on401(Model model) {
        return view401;
    }

    /**
     * The method to response on the 403 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 403 error view.
     */
    @RequestMapping(value=PATH_ERROR_403)
    public String on403(Model model) {
        return view403;
    }

    /**
     * The method to response on the 404 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 404 error view.
     */
    @RequestMapping(value=PATH_ERROR_404)
    public String on404(Model model) {
        return view404;
    }

    /**
     * The method to response on the 405 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 405 error view.
     */
    @RequestMapping(value=PATH_ERROR_405)
    public String on405(Model model) {
        return view405;
    }

    /**
     * The method to response on the 500 error view request.
     *
     * @param  model
     *         The model.
     *
     * @return the 500 error view.
     */
    @RequestMapping(value=PATH_ERROR_500)
    public String on500(Model model) {
        return view500;
    }
}
